#ifndef __PROXY_CONTAINER_HPP__
#define __PROXY_CONTAINER_HPP__

#include <iostream>
#include "selector.hpp"
#include "commprd_adapter.hpp"
#include "proxysrv_adapter.hpp"

using namespace std;

class proxy_container{

public:
//	vector < proxysrv_adapter * > proxysrv_p_vec;
	proxysrv_adapter proxysrv_array[ DH_MAX_CHANNUM ];

	u_int32 proxysrv_num;
	int proxysrv_type ;
	selector * sel_p;
	commprd_adapter * producer_p;
	time_t encoder_hbtime;

public:

	proxy_container();	
//	proxy_container( int srv_type );	
	~proxy_container();	

	void configure( CHANNEL_NOTIFY * channel_notify_p );
	BOOL create_proxys( commprd_adapter * producer_p );
	BOOL connect();
	void disconnect();
	void uninit();

	BOOL send_proxy_notify_all( XSocket * sock );
	void set_proxy_fd( selector * sel_p );

	BOOL check_proxy();

	void set_proxysrv_num( u_int32 proxysrv_num );
	u_int32 get_proxysrv_num();

	BOOL update_proxy(PRODUCER_ENCODER_UPDATE*);	
	int handle_connect_request( char * bufData );
	int handle_connect_close( char * bufData );
	int handle_iframe_request( char * bufData );
	int handle_cradle_op_request( char * bufData );
	int handle_videoparam_notify( char * bufData );
};

#endif
